<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        *{
            padding: 0;
            margin: 0;
        }
        div{
            width: 300px;
            height: 300px;
            border: 1px solid red;
            margin: 30px auto;
            display: flex;
            flex-flow: column;
        }
        li{
            list-style: none;
        }
        .di{
            display: flex;
        }
        .di li{
            height: 60px;
            font-size: 40px;
            font-weight: 900;
            display: flex;
            flex: 1;
            justify-content: center;
            align-items: center;
            background: rgb(131, 51, 51);
            user-select: none;
            cursor: pointer;
        }
        .di1{
            position: relative;
            flex: 1;
            background: rgb(52, 15, 172);
        }
        .di1 li{
            width: 100%;
            height: 100%;
            display: none;
            position: absolute;
            justify-content: center;
            align-items: center;
            font-size: 100px;
            font-weight: 900;
        }
        .di .active{
            background: rgb(35, 140, 11);
        }
        .di1 .active{
            display: flex;
        }
    </style>
</head>
<body>
    <div>
        <ul class="di">
            <li class="active">1</li>
            <li>2</li>
            <li>3</li>
        </ul>
        <ul class="di1">
            <li class="active">一</li>
            <li>二</li>
            <li>三</li>
        </ul>
    </div>
</body>
</html>
<script>
    const firstli = document.querySelectorAll('.di li')
    const lastli = document.querySelectorAll('.di1 li')
    firstli.forEach( (li,i) => {
        li.onclick = function() {

            {
                firstli.forEach(li => {
                    li.classList.remove('active')
                })
                this.classList.add('active')
            }

            {
                const lis = lastli[i]
                lastli.forEach(li =>{
                    li.classList.remove('active')
                })
                lis.classList.add('active')
            }

        }
    });
</script>